//
//  ClientEngine.h
//  viewtest
//
//  Created by xy on 10-2-9.
//  Copyright 2010 HANDPAY. All rights reserved.
//

#import <Foundation/Foundation.h>
#include "luaEngine.h"
#import <UIKit/UIKit.h>

#import "StreamEngine.h"
#import "HPCFDelegate.h"
#import "NSNetLib.h"
#import "SecureManager.h"

#define HPCLIENTENG [HPClientEngine getHPClientEngine]
#define DES_ENC(data)  [HPCLIENTENG.securmanager encryptDes:(data)]
#define DES_DEC(data)  [HPCLIENTENG.securmanager decryptDes:(data)]

@interface SaveData :NSObject{
	HPData * data;
}
@property HPData * data;
-(id)initwithData:(HPData *)datai;
@end


@interface HPClientEngine : NSObject {
	StreamEngine * se;
	NSUserDefaults *rms;
	NSMutableDictionary * hashGlobalData;
	SecureManager * securmanager;
    HPData * globalData;
    int netStatus;  //0 is unable 1 is gprs 2 is wifi
    id<HPAppDelegate> hpAppDelegate;
    NSString* appServer;
    
}
@property (nonatomic,retain) StreamEngine * se;
@property (nonatomic,retain) NSUserDefaults *rms;
@property (nonatomic,retain) NSMutableDictionary * hashGlobalData;
@property (nonatomic,retain) SecureManager * securmanager;
@property (nonatomic,assign) id<HPAppDelegate> hpAppDelegate;
@property (nonatomic,retain) NSString* appServer;
@property HPData * globalData;
@property int netStatus;

-(void)initengineUI;

-(void)startApp; // 框架启动入口

-(void)SaveRMSData:(NSString *) key withData:(const HPData *) data;
-(void)SaveRMSData:(NSString *) key withStr:(NSString *)str;
-(HPData *)GetRMSData:(NSString *) key;
-(NSString *)GetRMSString:(NSString *) key;
-(BOOL)isRMSHaveDataWithKey:(NSString*)key;

-(void)SaveGlobalData:(NSString *) data withKey:(NSString *)key;
-(NSString *)GetGlobalData:(NSString *)key;

+(HPClientEngine *)getHPClientEngine;
+(void)releaseInstance;
-(NSString*)getHeadVersion;


-(NSString*)getUrlByName:(NSString*)name;
@end
